package com.swift.violent.mainstay.config.expand;

import com.alibaba.fastjson.JSON;
import com.github.alenfive.rocketapi.extend.IAssertException;
import org.springframework.stereotype.Component;

/**
 * 默认参数验证异常处理类
 *
 * @author xuhaifeng
 * @date 2021.1.19 21:35
 */
@Component
public class DefaultAssertException implements IAssertException {
    @Override
    public void exception(String throwMsg, String... express) {
        if (express.length != 1) {
            throw new RuntimeException(String.format("Parameter length mismatch%s", JSON.toJSONString(express)));
        }
        throw new RuntimeException(throwMsg);
    }
}
